using System;
using System.Security;
using System.Security.Cryptography;
using System.IO;
using System.Collections.Generic;
using System.Text;
using stsdev.Builders.SourceFiles;

namespace stsdev
{
    public class StrongNameKeyBuilder
    {

        public static void CreateNew(string fileName)
        {
            CspParameters parms = new CspParameters();
            parms.KeyNumber = 2;
            RSACryptoServiceProvider provider = new RSACryptoServiceProvider(1024, parms);
            byte[] array = provider.ExportCspBlob(!provider.PublicOnly);

            using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
            {
                fs.Write(array, 0, array.Length);
            }

            //StrongNameKeyBuilder.AddKeyFileToProject(fileName);
        }

        public static void AddKeyFileToProject()
        {
            File.Copy(SolutionBuilder.KeyFileSource, SolutionBuilder.KeyFileName);
            SolutionBuilder.SolutionProvider.ProjectProvider.AddSourceFile(new SourceFile(SolutionBuilder.KeyFileName, SourceFileType.None));
        }

        public static void AddKeyFileToProject(string keyFile)
        {
        }
    }
}
